package com.chandra.pos.customer.dao.entity;

import com.chandra.pos.model.PosEntity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 * 
 * Customer Entity
 * 
 * @author onlinetechvision.com
 * @since 25 Mar 2012
 * @version 1.0.0
 *
 */
@Entity
@Table(name="CUSTOMERS")
public class Customer extends PosEntity {



	private String surname;

    @Column(name="FIRST_NAME", unique = false, nullable = false)
    private String firstName;

    @Column(name="LAST_NAME", unique = false, nullable = false)
    private String lastName;

    @Column(name="NICK_NAME", unique = false, nullable = true)
    private String nickName;

    @Column(name="EMAIL", unique = false, nullable = true)
    private String email;

    @Column(name="PRIMARY_CELL", unique = false, nullable = true)
    private String primaryCell;

    @Column(name="SECONDARY_CELL", unique = false, nullable = true)
    private String secondaryCell;

    @Column(name="CITY", unique = false, nullable = false)
    private String city;

    @Column(name="COUNTRY", unique = false, nullable = true)
    private String country;

    @Column(name="ZIP_CODE", unique = false, nullable = true)
    private String zipCode;

    @Column(name="ADDRESS", unique = false, nullable = true)
    private String address;


    @Column(name="COMPANY", unique = false, nullable = false)
    private String companyName;

    @Column(name="IS_SUPPLIER", unique = false, nullable = false)
    private Boolean isSupplier =Boolean.FALSE;


    public Boolean getSupplier() {
        return isSupplier;
    }

    public void setSupplier(Boolean supplier) {
        isSupplier = supplier;
    }

    public String getCompanyName() {
        return companyName;
    }

    public void setCompanyName(String companyName) {
        this.companyName = companyName;
    }


    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }


    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }


    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName;
    }


    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }


    public String getPrimaryCell() {
        return primaryCell;
    }

    public void setPrimaryCell(String primaryCell) {
        this.primaryCell = primaryCell;
    }


    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }


    public String getSecondaryCell() {
        return secondaryCell;
    }

    public void setSecondaryCell(String secondaryCell) {
        this.secondaryCell = secondaryCell;
    }


    public String getCountry() {
        return country;
    }

    public void setCountry(String country) {
        this.country = country;
    }


    public String getZipCode() {
        return zipCode;
    }

    public void setZipCode(String zipCode) {
        this.zipCode = zipCode;
    }


    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    /**
	 * Get Customer Id
	 * 
	 * @return int - Customer Id
	 */

	


    @Transient
    public String getName(){
        StringBuffer strBuff = new StringBuffer();
        strBuff.append(getSurname());
        strBuff.append(" ").append(getFirstName());
        strBuff.append(" ").append(getLastName());

        return strBuff.toString();

    }
	

	
	/**
	 * Get Customer Surname
	 * 
	 * @return String - Customer Surname
	 */
	@Column(name="SURNAME", unique = false, nullable = false)
	public String getSurname() {
		return surname;
	}
	
	/**
	 * Set Customer Surname
	 * 
	 * @param String - Customer Surname
	 */
	public void setSurname(String surname) {
		this.surname = surname;
	}	
	
	@Override
	public String toString() {
		StringBuffer strBuff = new StringBuffer();
		strBuff.append("id : ").append(id);
		strBuff.append(", name : ").append(getFirstName());
		strBuff.append(", surname : ").append(getSurname());
		return strBuff.toString();
	}
}
